#include "account.h"

Account::Account()
{

}

Account::Account(QString account, QString password)
{
    this->Acc_account=account;
    this->Acc_password=password;
}

Account::Account(const Account &acc)
{
    this->Acc_account=acc.Acc_account;
    this->Acc_password=acc.Acc_password;
}

QString Account::getAccount()
{
    return this->Acc_account;
}

QString Account::getPassword()
{
    return this->Acc_password;
}

QTextStream &operator<<(QTextStream &out, const Account &acc)
{
    out<<acc.Acc_account<<"\3"<<acc.Acc_password;
    return out;
}

QTextStream &operator>>(QTextStream &in, Account &acc)
{
    QString line = in.readLine();
    int index = line.indexOf('\3');
    if(index != -1)
    {
        acc.Acc_account = line.left(index);
        acc.Acc_password = line.mid(index + 1);
    }

    return in;
}
